<template>
    <!-- 选择业务经理组件 -->
    <Select
      :filterable="isFilterable"
      ref="select"
      :value="salesmanId"
      :placeholder="placeContent"
      :disabled="disabled"
      style="width: 100%"
      transfer
      :clearable="false"
      :label-in-value="true"
      @on-change="changeData"
    >
    <Option
      v-for="(item, index) in dataList"
      :tag="item.code"
      :value="item.userId"
      :key="item.userId + index"
      >{{ item.realName }}</Option
    >
    </Select>
  
    <!-- 单选业务经理select
    <QdSelectSalesman
      ref="QdSelectSalesman"
      :salesmanId.sync="MX_searchData.salesmanId"
      :salesmanName.sync="MX_searchData.salesmanName"
      :salesmanCode.sync="MX_searchData.salesmanCode"
    ></QdSelectSalesman>-->
  </template>
  
  <script>
//   import { SysOrganizationApi } from "@/api/system/SysOrganizationApi";
  
  export default {
    name: "QdSelect",
    props: {
      salesmanId: {
        type: String,
        default: "",
      }, // 选择的id
      isFilterable: {
        type: Boolean,
        default: true,
      }, // 是否开启搜索
      salesmanType: {
        type: String,
        default: "",
      }, // 销售 or 采购
      placeContent: {
        type: String,
        default: "请选择业务经理",
      }, // placeholder
      disabled: {
        type: Boolean,
        default: false,
      }, // 是否能选择
    },
    data() {
      return {
        dataList: [],
      };
    },
    watch: {},
    mounted() {
      this.getSalesmanList();
    },
    methods: {
      changeData(val) {
      this.$emit("update:salesmanId", val.value);
      this.$emit("update:salesmanName", val.label);
      this.$emit("update:salesmanCode", 'YWJL');
      this.$emit("changeData", val);
      },
      getSalesmanList() {
        let data = {
            positionCode:"YWJL"
        }
        this.httpGet(this.API.API_salemanList,data)
          .then((res) => {
            this.dataList = res.data;
          })
          .catch((err) => {
            console.log("接口报错:", err);
          });
      },
    },
  };
  </script>
  <style lang="less" scoped>
  </style>
  
  
  